export function checkPhone(num){
    if(!(/^1[34578]\d{9}$/.test(num))){ 
        //alert("手机号码有误，请重填");  
        return false; 
    }else{
        return true;
    }
}
export function getClientHeight()
{
  var clientHeight=0;
  if(document.body.clientHeight&&document.documentElement.clientHeight)
  {
  var clientHeight = (document.body.clientHeight<document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
  }
  else
  {
  var clientHeight = (document.body.clientHeight>document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
  }
  return clientHeight;
}

export class Tab{
    constructor(id){
        this.oTab = document.getElementById(id);
        this.aBtn = this.oTab.getElementsByTagName('li');
        this.init();
    }
    init(){
        for (let i = 0; i < this.aBtn.length; i++) {
            this.aBtn[i].onclick = function(){
                this.hide();
                this.show(i);
                this.isNow = i;
            }.bind(this);
        }
    }
    hide(){
        for (let i = 0; i < this.aBtn.length; i++) {
            this.aBtn[i].className = '';
        }
    }
    show(index){
        this.aBtn[index].className = 'active';
    }
}

